﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Join : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
        {
            connection.Open();
            SqlCommand command = new SqlCommand(null, connection);

            // Create and prepare an SQL statement.
            command.CommandText =
                "SELECT * from Game";

            // Call Prepare after setting the Commandtext and Parameters.
            command.Prepare();
            ListBox1.DataValueField = "GameName";
            ListBox1.DataSource = command.ExecuteReader();
            ListBox1.DataBind();
        }

    }
    protected void btnStart_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Start.aspx");
    }
}